package com.jman.reply.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jman.reply.dao.ReplyDao;
import com.jman.reply.domain.Reply;
import com.jman.reply.dto.ReplyToUser;
import com.jman.reply.service.IReplyService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReplyServiceImpl extends ServiceImpl<ReplyDao, Reply> implements IReplyService {

    public List<ReplyToUser> getReply(Long id) {
        QueryWrapper<Reply> wrapper = new QueryWrapper<>();
        System.out.println(id);
        wrapper.lambda().eq(Reply::getReceiverId, id);
        List<Reply> list = list(wrapper);
        System.out.println(list);
        List<ReplyToUser> reply = BeanUtil.copyToList(list, ReplyToUser.class);
        return reply;
    }
}
